exports.MMActionAlertWindow = GL2.Node.subclass(
{
    classname: 'MMActionAlertWindow',
    
    initialize: function(text) 
    {
		this._backgroundImage = null;
		this._actionTextLabel = null;
		this._crossButton = null;
		this._text = "";
		if(text)
		{
			this._text = text;
		}
    },
	
	createView: function() 
	{
		var backgroundPath = this.getBaseResourcePath()+ "bar-background.png";
		var closeButtonPathNormal = this.getBaseResourcePath()+ "close-button-normal.png";
		var closeButtonPathPressed = this.getBaseResourcePath()+ "close-button-pressed.png";
		
		
		this._backgroundImage = GLFactory.getSprite([TCUtil.getAdjustedX(10),TCUtil.getAdjustedY(50)], null, backgroundPath, [TCUtil.getAdjustedX(265),TCUtil.getAdjustedY(ACTION_ALERT_WINDOW_HEIGHT)]);
		this.addChild(this._backgroundImage);		
		
		this._actionTextLabel = GLFactory.getText([TCUtil.getAdjustedX(20), TCUtil.getAdjustedY(15)], 100,this._text, [TCUtil.getAdjustedX(240), TCUtil.getAdjustedY(40)], TCUtil.getAdjustedFontSize(120), null, null, GL2.Text.OverflowMode.ReduceFontSize, [0.0, 0.5], new Core.Color(0,0,0));
		this._backgroundImage.addChild(this._actionTextLabel);		
		
		if(TutorialManager.getHasCompletedTutorial())
		{
			this._closeButton = new GLButton(closeButtonPathNormal, closeButtonPathPressed, TCUtil.getAdjustedX(40),TCUtil.getAdjustedY(40), this.onCloseTouch.bind(this), this._backgroundImage, 3, "", null, null, null,null);
			this._closeButton.setPosition(TCUtil.getAdjustedX(280), TCUtil.getAdjustedY(20));
		}
		else 
		{
			this._backgroundImage.setPosition([TCUtil.getAdjustedX(25), TCUtil.getAdjustedY(50)]);
		}
	},
	
	onCloseTouch: function()
	{
		this.destroy();
	},
	
	getNodeHeight : function()
	{
		
	},

	getBaseResourcePath: function()
	{
		return "./Content/images/gamelayer/controllayer/";
	},
	
	destroy: function ()
	{
		MMGameVariables.setPurchasedItemId(null);
		MMGameVariables.setPurchasedItem(null);
		MMGameVariables.setActionType(kActionType.kActionArrow);
		MMGameLayer.getControlLayer()._actionAlert = null;
		if(this._backgroundImage)
		{
			this._backgroundImage.destroy();
			this._backgroundImage = null;
		}
		if(this._actionTextLabel)
		{
			this._actionTextLabel.destroy();
			this._actionTextLabel = null;
		}
		if(this._closeButton)
		{
			this._closeButton.destroy();
			this._closeButton = null;
		}
	}
});